package net.oschina.archx.spring.service;

import net.oschina.archx.spring.dao.local.LocalUserMapper;
import net.oschina.archx.spring.dao.remote.RemoteUserMapper;
import net.oschina.archx.spring.entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Created by Archx on 2015/6/22 0022.
 */
@Service
public class UserService {

    @Autowired
    private LocalUserMapper lum;

    @Autowired
    private RemoteUserMapper rum;

    public int localSave(User user) {
        return lum.save(user);
    }

    public int remoteSave(User user) {
        return rum.save(user);
    }

    public void save(User local, User remote) {
        lum.save(local);
        System.err.println("lcoal insert success ! - > " + local);
        rum.save(remote);
        System.err.println(remote);
    }
}
